package org.smr.ministore.service.impl;

import java.util.List;

import org.blade.dao.base.BaseMapper;
import org.blade.utils.IdGenUtils;
import org.blade.utils.Pager;
import org.blade.service.base.AbstractService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smr.ministore.dao.GoodsMapper;
import org.smr.ministore.entities.Goods;
import org.smr.ministore.entities.GoodsOrgan;
import org.smr.ministore.entities.vo.Assign2OrganVO;
import org.smr.ministore.entities.vo.Assign2OrgansVO;
import org.smr.ministore.service.GoodsService;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service("GoodsServiceFacade")
@Transactional(readOnly = false)
public class GoodsServiceFacade extends AbstractService<Long,Goods> implements GoodsService {


    private static Logger logger = LoggerFactory.getLogger(GoodsServiceFacade.class);

    @Resource(name="GoodsServiceImpl")
	private GoodsService goodsService;

    @Autowired
	public GoodsServiceFacade(GoodsMapper mapper) {
		super(mapper);
	}

	public int save(Goods entity) {
		return goodsService.save(entity);
	}

	public int updateById(Goods id) {
		return goodsService.updateById(id);
	}

	@Transactional(readOnly = true)
	public Goods queryById(Long id) {
		return goodsService.queryById(id);
	}

	public int deleteById(Long id) {
		return goodsService.deleteById(id);
	}

	@Transactional(readOnly = true)
	public Pager<Goods> paginate( Goods entity, Long pageSize, Long pageNum) {
		return goodsService.paginate(entity, pageSize, pageNum);
    }
	
	public int batchSave(List<Goods> entities) {
		return goodsService.batchSave(entities);
	}


    public int batchModify(List<Goods> entities) {
        return goodsService.batchModify(entities);
	}

    public int deleteByIdLogical(Long id) {
        return goodsService.deleteByIdLogical(id);
    }

    public int assign(Assign2OrganVO goodsAssign2Organ) {
        return goodsService.assign(goodsAssign2Organ);
    }

	public List<GoodsOrgan> queryGoodsAssignee(Assign2OrgansVO assignee) {
		return null;
	}

	@Transactional(readOnly = true)
	public Goods queryByPrimaryKey(Goods goods) {
		return goodsService.queryByPrimaryKey(goods);
	}

    public int assign(Assign2OrgansVO assignee) {
        return goodsService.assign(assignee);
    }

	public Long getId() {
		return IdGenUtils.getNextLongId();
	}
}
